/**
 * Created by djh on 2016/12/20.
 * 资金js
 */
define(function(require,exports) {
    var common =require("common");
    var account =require("account");
    var template =require("jtemplate");
    require("validate");
    require("v-addmethod");

    //交易密码修改
    $('[data-act="deal_pass"]').on("click",function(){

        var html = template("dealValid",{});
        layer.open({
            type:1,
            content:html,
            btn:["确定","取消"],
            title:["更改交易密码"],
            area:['600px'],
            success:function(layero,index){
                var $form = layero.find("form");
                //获取验证码
                var $getBtn = $('[data-act="getSMS"]');
                var $mobile = $('#username');
                common.getCode($getBtn,3,null);

                $form.validate({
                    ignore: ".ignore",
                    rules:{
                        password:{required: true,sixPwd:true},
                        sure_pwd:{required: true,equalTo:"#pwd"},
                        vcode:{required: true}
                    },
                    messages:{
                        password:{required: "请输入密码"},
                        sure_pwd:{required: "请确认密码",equalTo:"两次密码不一致"},
                        vcode:{required: "请输入手机验证码"}
                    },
                    submitHandler:function(f){
                        common.ajaxHandle({
                            url:"/admin/fund/do_tradePass",
                            data:$form.serialize()
                        });

                    }
                });
            },
            yes:function(index,layero){
                var $form = layero.find("form");
                $form.submit();
            }
        })
    });

    //气泡初始化
    common.tooltips();
})
